# -*- coding: utf-8 -*-
"""
@Time ： 2023/1/1 13:03
@Auth ： jiraWu
@File ：bs4爬取星巴克数据.py
@IDE ：PyCharm
@Motto:人生苦短，我学Python

"""
from jira_wu_dev_utils._request import GetRequest
from bs4 import BeautifulSoup

url = "https://www.starbucks.com.cn/menu/"
cont = GetRequest(url=url).send_req()
soup = BeautifulSoup(cont, 'lxml')
# //ul[@class="grid padded-3 product"]//strong/text()
obj_name = soup.select('ul[class="grid padded-3 product"] strong')
obj_img = soup.select('ul[class="grid padded-3 product"] div')
# print(obj_img)
for img in obj_img:
    print(f"https://www.starbucks.com.cn"+img.attrs.get("style").split('"')[1])
for name in obj_name:
    print(name.getText())
